package ro.jproject.imc;

import java.beans.XMLEncoder;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

public class SaveXmlInfo extends StudentRegistrationGUI {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	FileOutputStream os;
	XMLEncoder encoder;
	
	
	public void saveToXmlStudent(int studentNo, String status){
		
		try {
			os = new FileOutputStream("D:/person.xml");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		encoder = new XMLEncoder(os);
		
		Student student = new Student();
		student.setStudentNo(studentNo);
		student.setStatus(status);
		
		encoder.writeObject(student);
		encoder.close();
	}

	public void saveToXmlPerson(String saveFirstName, String saveLastName) {
		
		
		
		try {
			os = new FileOutputStream("D:/persons.xml");
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		encoder = new XMLEncoder(os);
		
		Person person = new Person();
		person.setFirstName(saveFirstName);
		person.setLastName(saveLastName);
		encoder.writeObject(person);
		encoder.close();
	}
}
